~res = "/home/justin/noisesmith-linux-audio/joy/res/";
~imDict = this.executeFile( ~res ++ "info.sc" );
~paras = this.executeFile( ~res ++ "maclowText.sc" );
~resetOsc = {
	SwingOSC.default.quit;
	SwingOSC.program = "/usr/local/bin/SwingOSC.jar";
	SwingOSC.default.options.javaOptions =
	"-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel";
};

~resetOsc.();

~makePara = { | nth |
	Routine { fork {
		SwingOSC.default.boot;
		2.wait;
		~iX = 0;
		~iY = 0;
		~game = Game.new( "J O Y ( " ++ nth ++ " )", 800, 600 );
		~paras[ nth ].do{ | letter |
			var sprite;
			var referent = ~imDict[ letter.asSymbol ];
			if ( referent.notNil, {
				if(  not( letter.isUpper ), {
					if( referent[ 3 ].isNil, {
						referent[ 3 ] = JSCImage.open( ~res++letter++".png" )
					} );
					sprite = Sprite.new( [ referent[ 3 ] ],
						type: \obstacle,
						symbol: letter.asSymbol );
					~game.addSprite( sprite, 1000 );
					sprite.x = ~iX;
					sprite.y = ~iY+referent[ 2 ];
				} );
				~iX = referent[ 0 ] + ~iX + 24;
			}, {
				if( letter == $\n, {
					~iY = 30 + ~iY;
					~iX = 0
				}, {
					~iX = 10 + ~iX } ) } ) };
		~game.start;
		~paras[ nth ].postln
	} }.play };


















~makePara.( 36 )
